#encoding: utf-8
'''
Created on 2012-4-9

@author: huangjacky
@copyright: TeamV - Group: WhutOJ
执行模块
'''

from pyojExecutorThread import PyOJExecutorThread

class PyOJExecutor(object):
    '''
    将数据执行，并返回执行结果
    '''

    def __init__(self, data=None):
        super(PyOJExecutor, self).__init__()
        self.__data = data 
        
    def execute(self, data=None):
        if data != None:
            d = data
        else:
            d = self.__data
        if d == None:
            return None
        # 开始 执行，放入
        thd = PyOJExecutorThread(d)
        thd.start()
        
    # getter and setter
    def getData(self):
        return self.__data
    
    def setData(self, value):
        self.__data = value
        
    data = property(getData, setData, None, None) 
